<!DOCTYPE html>
<html lang="en">
<head>
    {include file='public/meta'/}
    <!-------------开关按钮css-------------->
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">

    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/tidy.css">


    <link rel="stylesheet" href="__STATIC_URL__/static/css/addmchat.css"/>

    <script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
    <script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=KNPBZ-RXKWI-SJJGI-5S3HH-AGDS6-Q6BDW"></script>

    <script src="__STATIC_URL__/static/js/area.js"></script>

    <style>
        .nav-tabs > li.active > a.navt, .nav-tabs > li.active > a.navt:focus, .nav-tabs > li.active > a.navt:hover {
            border-color: rgb(48, 146, 255) rgb(48, 146, 255) rgb(48, 146, 255);
            border-bottom: 2px solid rgb(48, 146, 255) !important;
            transition: all 0.4s ease 0s;
            color: rgb(48, 146, 255);
            border-top: none;
            border-left: none;
            border-right: none;
        }

        .bgctitle {
            height: 26px;
            line-height: 26px;
            color: rgb(48, 146, 255);
            font-size: 16px;
            margin: 30px 44px;
        }

        .bgctitle span {
            width: 2px;
            height: 16px;
            margin-top: 5px;
            display: inline-block;
            float: left;
            margin-right: 10px;
            background: rgb(48, 146, 255);
        }
    </style>
    <script>
        //调用poi类信接口
        //清除地图上的marker

        function clearOverlays(overlays) {
            var overlay;
            while (overlay = overlays.pop()) {
                overlay.setMap(null);
            }
        }
        function geolocation_localcity(id) {
            //console.log(132146);
            var objS  = document.getElementById(id);
            var index=objS.selectedIndex ;
            localcity = objS.options[index].value;

            console.log(11,localcity);
            clearOverlays(markers);
            searchService.search(localcity);
            //citylocation.searchCityByName(localcity);

        }
        function searchKeyword() {
            var localcity = document.getElementById("keyword").value;
            console.log(localcity);
            clearOverlays(markers);
            searchService.search(localcity);
            //citylocation.searchCityByName(localcity);


        }

        $(function(){
            locat()
        })
        function locat(){
            var data=[];
            $.ajax({
                url: "{:url('store/getIpWsLocation')}",
                type: 'post',
                async: true,
                data: {},
                success: function (data) {
                    console.log(22,data);
                    var data=data.location;
                    init(data)
                }
            })
            //console.log(data);
        }


        var searchService,geocoder,citylocation, map, markers = [];
        var init = function (data) {

            var center = new qq.maps.LatLng(data.lat,data.lng);
            map = new qq.maps.Map(document.getElementById('container'), {
                center: center,
                zoom: 13,
                panControl: true,
                zoomControl: true,
                zoomControlOptions: {
                    style: qq.maps.ZoomControlStyle.SMALL
                }
            });

            ///
            var city = document.getElementById("address");
            citylocation = new qq.maps.CityService({
                complete : function(results){
                    map.setCenter(results.detail.latLng);
                    city.style.display = 'inline';
                    city.innerHTML = '所在位置: ' + results.detail.latLng;
                    if (marker != null) {
                        marker.setMap(null);
                    }
                    console.log(city);
                    marker = new qq.maps.Marker({
                        map: map,
                        position: results.detail.latLng
                    });
                }
            });
            //
            var latlngBounds = new qq.maps.LatLngBounds();
            //调用Poi检索类
            searchService = new qq.maps.SearchService({
                complete: function (results) {
                    var pois = results.detail.pois;
                    for (var i = 0, l = pois.length; i < l; i++) {
                        var poi = pois[i];
                        latlngBounds.extend(poi.latLng);
                        var marker = new qq.maps.Marker({
                            map: map,
                            position: poi.latLng
                        });
                        marker.setTitle(i + 1);
                        markers.push(marker);
                    }
                    map.fitBounds(latlngBounds);
                }
            });

            var marker = new qq.maps.Marker({
                map: map,
                position: center
            });

            var infoWin = new qq.maps.InfoWindow({
                map: map
            });
            qq.maps.event.addListener(
                map,
                'click',
                function (event) {
                    $("#latitude").val(event.latLng.getLat());
                    $("#longitude").val(event.latLng.getLng());
                    $.ajax({
                        url: "{:url('store/getaddress')}",
                        type: 'post',
                        async: true,
                        data: {
                            lat: event.latLng.getLat(),
                            lng: event.latLng.getLng()
                        },
                        success: function (data) {
                            infoWin.open();
                            infoWin.setContent('<div style="text-align:center;white-space:nowrap;margin:10px;">' + data.address + '</div>');
                            infoWin.setPosition(event.latLng);
                            $("#address").val(data.address);
                            $("#province").val(data.address_component.province);
                            $("#city").val(data.address_component.city);
                            $("#district").val(data.address_component.district);
                            $("#street").val(data.address_component.street);
                            $("#street_number").val(data.address_component.street_number);
                        },
                        error: function () {
                            alert("获取地址失败");
                        }
                    })
                }
            );
        }
    </script>
</head>
<body onload="init()">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li><a href="javascript:history.back();">门店管理</a></li>
                <li class="active" style="color: #02b87f;"> 修改门店</li>
            </ul>
        </div>
        <div class="panel panel-default mgl15 mgr15">
            <div class="panel-heading addCharts" style="background:#ededed;">修改门店</div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action="" name="form" method="post" id="mach"
                      enctype="multipart/form-data">
                    <ul id="myTab" class="nav nav-tabs">
                        <li class="active"><a href="#jichu" data-toggle="tab">基础信息</a></li>
                        <li><a href="#weihu" data-toggle="tab">支付信息</a></li>
                        <li><a href="#feil" data-toggle="tab">费率设置</a></li>

                    </ul>
                    <div id="myTabContent" class="tab-content" style="padding-top:15px;">
                        <div class="tab-pane fade in active" id="jichu">
                            <div class="form-group" id="ferror1">
                                <label class="col-sm-2 col-sm-2 control-label">门店名称：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt4" value="{$user['merchant']}" id="merchant" name="merchant">
                                    <div id="error1" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">门店LOGO：</label>
                                <div class="col-sm-10">
                                    <input type="file" id="exampleInputFile" onchange="publicUpload('exampleInputFile')">
                                    <input type="hidden" value="{$user['img']}" name="img" class="exampleInputFile-ipt" id="img">
                                    {if condition="$user['img'] neq ''"}
                                    <img src="{$user['img']}" class="exampleInputFile-src"  alt="" style="width:150px;height: 150px;margin: 15px auto;float: left;">
                                    {/if}
                                </div>
                            </div>
                            <div class="form-group" id="ferror3">
                                <label class="col-sm-2 col-sm-2 control-label">门店联系人：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt4" id="contacts" value="{$user['MerchantContent']['contacts']}" name="contacts">
                                    <div id="error3" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="ferror4">
                                <label class="col-sm-2 col-sm-2 control-label">门店电话：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control ipt4" id="tel" value="{$user['MerchantContent']['tel']}" name="tel">
                                    <div id="error4" class="error"></div>
                                </div>
                            </div>
                            <!--地图坐标-->
                            <div class="form-group hide">
                                <label class="col-sm-2 col-sm-2 control-label">坐标系：</label>
                                <div class="col-sm-10">
                                    <select name="offset_type" class="form-control border-no">
                                        <option value="1">火星坐标</option>
                                        <option value="2">SOGOU经纬度</option>
                                        <option value="3">为百度经纬度</option>
                                        <option value="4">mapbar经纬度</option>
                                        <option value="5">为GPS坐标</option>
                                        <option value="6">SOGOU墨卡托坐标</option>
                                    </select>
                                    <div class="error"></div>
                                </div>
                            </div>

                            <div class="form-group hide">
                                <label class="col-sm-2 col-sm-2 control-label">地理位置经度：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="longitude" name='longitude' placeholder="火星坐标">
                                    <div class="error"></div>
                                </div>
                            </div>

                            <div class="form-group hide">
                                <label class="col-sm-2 col-sm-2 control-label">地理位置纬度：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="latitude" name='latitude' placeholder="火星坐标">
                                    <div class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="area">
                                <label class="col-sm-2 col-sm-2 control-label">地区：</label>
                                <div class="col-sm-4">
                                    <div class="input-group">
                                        <select class="form-control" id="s_province" name="" onclick="geolocation_localcity('s_province')">

                                        </select>
                                        <div class="input-group-addon">-</div>
                                        <select class="form-control" name="" id="s_city" onclick="geolocation_localcity('s_city')">

                                        </select>
                                        <div class="input-group-addon">-</div>
                                        <select class="form-control" name="" id="s_county" onclick="geolocation_localcity('s_county')">

                                        </select>
                                        <div id="error13" class="error"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">搜索地点：</label>
                                <div class="col-sm-10">
                                    <input id="keyword" type="textbox" class="form-control ipt4" oninput="searchKeyword()" placeholder="在下方地图上单击地址完成选择">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">选取地址：</label>
                                <div class="col-sm-10">
                                    <div id="container" style="height:500px;width: 80%;"></div>
                                </div>
                            </div>

                            <div class="error"></div>
                            <!--地图-end-->
                            <div class="form-group" id="ferror5">
                                <label class="col-sm-2 col-sm-2 control-label">门店地址：</label>
                                <div class="col-sm-10">
                                    <input type="hidden" name="id" value="{$user['id']}">
                                    <input type="hidden" id="province" name="province" value="{$user['province']}">
                                    <input type="hidden" id="city" name="city" value="{$user['city']}">
                                    <input type="hidden" id="district" name="district" value="{$user['district']}">
                                    <input type="text" class="form-control ipt6" id="address" name="address" value="{$user['MerchantContent']['address']}">
                                    <div id="error5" class="error"></div>
                                </div>
                            </div>
                            <div class="form-group" id="levelst">
                                <label class="col-sm-2 col-sm-2 control-label">行业：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                <div class="col-sm-6">
                                    <div class="input-group">
                                        <select class="form-control" id="primary" name="leibie" onchange="second_lb(this)">
                                            {if condition="$user['leibie'] neq '' "}
                                            <option value="{$user['leibie']}">{$user['leibie']}</option>
                                            {/if}
                                            <option value="">请选择</option>
                                            {volist name="cate" id="vo"}
                                            <option value="{$vo['name']}" data-id="{$vo['id']}">{$vo['name']}</option>
                                            {/volist}
                                        </select>
                                        <div class="input-group-addon">-</div>
                                        <select class="form-control" name="leibie2" id="secondary">
                                            {if condition="$user['leibie2'] neq '' "}
                                            <option value="{$user['leibie2']}">{$user['leibie2']}</option>
                                            {/if}
                                            <option value="">请选择</option>
                                        </select>
                                        <div id="error11" class="error"></div>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group" id="ferror8" style="display: none;">
                                <label class="col-sm-2 col-sm-2 control-label" id="levellb">二级类别：</label>
                                <div class="col-sm-10">
                                    <input type="text" id="level" name="level2" class="form-control ipt4">
                                    <div id="error8" class="error"></div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">门店通知设定：</label>
                                <div class="col-sm-10">
                                    <div class="switch switch-small" id="tz_setting" data-animated="true" style="height: 25px;">
                                        <input type="checkbox" name="tz_setting" class="tz_setting" value="1"
                                               {if condition="$user['tz_setting'] eq '1' "}checked{/if}/>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">是否开启刷卡支付：</label>
                                <div class="col-sm-10">
                                    <div class="switch switch-small" id="is_cartpay" data-animated="true" style="height: 25px;">
                                        <input type="checkbox" name="is_cartpay" value="1" class="is_cartpay" {if condition="$user['is_cartpay'] eq '1' "}checked{/if}/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane fade" id="weihu">

                            <div id="myTabContent1" class="tab-content" style="">
                                <div class="" id="offical_set">
                                    <div class="panel panel-default">
                                        <div class="panel-heading">
                                            <h4 class="panel-title">
                                                <a data-toggle="collapse" data-parent="#offical_set"
                                                   href="#tongdao_set">
                                                    通道设置
                                                </a>
                                            </h4>
                                        </div>
                                        <div id="tongdao_set" class="panel-collapse collapse in">
                                            <div class="panel-body">

                                                <div class="tab-pane fade in active" id="tab_weixin">
                                                    <div class="form-group" style=" border-bottom: none;   ">
                                                        <label class="col-sm-2 col-sm-2 control-label"
                                                               style=" ">微信通道：</label>
                                                        <input type="hidden" id="tongdao" value="{$user['wechat_way']}" name="wechat_way">
                                                        <label type="text" id="xuan" class="ipt4 control-label"
                                                               style="width:150px; text-align: left;">微信官方通道</label>
                                                        <a href="javascript:;" onclick="showmy('tongdao','微信官方通道');"
                                                           class="col-sm-1 btn-link"
                                                           style="float: none; display: inline-block;margin-top: 6px;margin-left:5px;font-size:13px;">选择</a>
                                                    </div>
                                                    <div class="form-group" style=" border-bottom: none;">
                                                        <label class="col-sm-2 col-sm-2 control-label"
                                                               style="  ">支付宝通道：</label>
                                                        <input type="hidden" id="tongdao2" value="{$user['ali_way']}" name="ali_way">
                                                        <label type="text" id="xuan2" class="ipt4 control-label"
                                                               style="width:150px; text-align: left;">支付宝官方通道</label>
                                                        <a href="javascript:;" onclick="showmy('tongdao2','支付宝官方通道');"
                                                           class="col-sm-1 btn-link"
                                                           style="float: none; display: inline-block;margin-top: 6px;margin-left:5px;font-size:13px;">选择</a>
                                                    </div>


                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h4 class="panel-title">
                                        <a data-toggle="collapse" data-parent="#offical_set"
                                           href="#offical">
                                            官方通道配置
                                        </a>
                                    </h4>
                                </div>
                                <div id="offical" class="panel-collapse collapse">
                                    <div class="panel-body">
                                        <div class="bgctitle ">
                                            <span></span>微信通道配置
                                        </div>
                                        <div class="form-group" id="ferror2">
                                            <label class="col-sm-2 col-sm-2 control-label">微信商户号：</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="sub_mch_id" name="sub_mch_id"
                                                       class="form-control ipt4" value="{$user['sub_mch_id']}">
                                                <div id="error2" class="error"></div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="ferror10">
                                            <label class="col-sm-2 col-sm-2 control-label">回调地址：</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control ipt4" value="{$user['notify_url']}" id="notify_url" name="notify_url">
                                                <div id="error10" class="error"></div>
                                            </div>
                                        </div>
                                        <div class="bgctitle ">
                                            <span></span>支付宝通道配置
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">授权Token：</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="ali_merid" name="ali_merid"
                                                       class="form-control ipt4" value="{$user['ali_merid']}">
                                                <a href="javascript:;" data-toggle="modal" data-target="#myModal" class="col-sm-1 col-sm-1 btn btn-info btsp">授权</a>

                                                <div class="error"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">口碑商户ID：</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="ali_store_id" name="ali_store_id"
                                                       class="form-control ipt4" value="{$user['ali_store_id']}">
                                                <div class="error"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h4 class="panel-title">
                                        <a data-toggle="collapse" data-parent="#offical_set"
                                           href="#mybank">
                                            网商通道配置
                                        </a>
                                    </h4>
                                </div>
                                <div id="mybank" class="panel-collapse collapse">
                                    <div class="panel-body">
                                        <div class="bgctitle ">
                                            <span></span>网商通道配置
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">商户门店ID</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="lft_merchant_no" name="lft_merchant_no"
                                                       class="form-control ipt4" value="{$user['lft_merchant_no']}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">商户ID</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="lft_core_merchant_no" name="lft_core_merchant_no"
                                                       class="form-control ipt4" value="{$user['lft_core_merchant_no']}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">商户pid</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="lft_pid" name="lft_pid"
                                                       class="form-control ipt4" value="{$user['lft_pid']}">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 col-sm-2 control-label">商户key</label>
                                            <div class="col-sm-10">
                                                <input type="text" id="lft_key" name="lft_key"
                                                       class="form-control ipt4" value="{$user['lft_key']}">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="isdiyset" class="hidden">

                            </div>
                        </div>

                        <div class="tab-pane fade" id="feil">
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">微信费率</label>
                                <div class="col-sm-10">
                                    <input type="number" id="wx_service_charge" value="{$user['wx_service_charge']}" name="wx_service_charge" class="form-control ipt4" style="width: 10%;">
                                    <label class="control-label">&nbsp; ‰</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">支付费率</label>
                                <div class="col-sm-10">
                                    <input type="number"  id="ali_service_charge" value="{$user['ali_service_charge']}" name="ali_service_charge" class="form-control ipt4" style="width: 10%;">
                                    <label class="control-label">&nbsp; ‰</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">刷卡费率</label>
                                <div class="col-sm-10">
                                    <input type="number"  id="pos_service_charge" value="{$user['pos_service_charge']}" name="pos_service_charge" class="form-control ipt4" style="width: 10%;">
                                    <label class="control-label">&nbsp; ‰</label>
                                </div>
                            </div>
                        </div>


                    </div>
                    <div style="text-align: center">
                        <button type="button" onclick="addform()" class="btn btn-primary">修改商户</button>
                    </div>
                </form>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel1">选择通道</h4>
            </div>
            <div class="modal-body">
                <div class="form-group" style="height:150px;">
                    <label class="col-sm-2 col-sm-2 control-label" style="    margin-top: 10px;">选择通道：</label>
                    <div class="col-sm-5 col-sm-5">
                        <div class="radio">
                            <label id="way">
                                <input type="radio" name="shtd" id="optionsRadios3" value="0" checked >官方通道
                            </label>
                        </div>
                        <div class="radio">
                            <label >
                                <input type="radio" name="shtd" id="optionsRadios4" value="10" >网商通道
                            </label>
                        </div>
                        <div class="radio">
                            <label >
                                <input type="radio" name="shtd"  id="optionsRadios5" value="2" >官方无会员卡支付通道
                            </label>
                        </div>
                    </div>

                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-way="" id="wid" onclick="xuanz(this)">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">支付宝授权</h4>
            </div>
            <div class="modal-body">
                {if condition="$surl neq '' "}
                授权链接:
                <div>{$surl}</div>
                <div style="text-align: center">
                    <div>或者使用支付宝扫描下方二维码</div>
                    <img width="150px" height="150px" src="{$qrcode}">
                </div>
                {else/}
                服务商未开启支付宝
                {/if}
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="ajaxtj({$user['top_mid']})">提交更改</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<script src="__STATIC_URL__/static/js/tidy.js"></script>
<script>
    function showmy(tid, way) {
        console.log(33,tid);
        if (tid == "tongdao") {
            $("#way").html(" <input type='radio' name='wechat_way' id='optionsRadios3' value='0' checked >微信官方通道");
            $("#optionsRadios3").prop("name", "wechat_way");
            $("#optionsRadios4").prop("name", "wechat_way");
            $("#optionsRadios5").prop("name", "wechat_way");
            $("#wid").attr("data-way", "tongdao");
            $("#myModal1").modal('show');
        } else if (tid == "tongdao2") {
            $("#way").html(" <input type='radio' name='ali_way' id='optionsRadios3' value='0' checked >支付宝官方通道");
            $("#optionsRadios3").prop("name", "ali_way");
            $("#optionsRadios4").prop("name", "ali_way");
            $("#optionsRadios5").prop("name", "ali_way");
            $("#wid").attr("data-way", "tongdao2");
            $("#myModal1").modal('show');
        }

    }
</script>
<script>
    $(function(){


        var wechat_way= $("#tongdao").val();
        var ali_way= $("#tongdao2").val();

        if(parseInt(wechat_way)==0){
            $("#xuan").html("微信官方通道");
        }else if(parseInt(wechat_way)==2){
            console.log(132,wechat_way);
            $("#xuan").html("官方无会员卡支付通道 ");
        }else if(parseInt(wechat_way)==10){
            $("#xuan").html("网商通道");
        }
        if(parseInt(ali_way)==0){
            $("#xuan2").html("支付宝官方通道");
        }else if(parseInt(ali_way)==2){
            $("#xuan2").html("官方无会员卡支付通道 ");
        }else if(parseInt(ali_way)==10){
            $("#xuan2").html("网商通道");
        }

    })
</script>
<script>
    function xuanz(obj) {
        var wid = $("#wid").attr("data-way");
        console.log(333, wid);
        if (wid == "tongdao") {
            var wechat_way = parseInt($('input[name="wechat_way"]:checked').val());
            console.log(12132, wechat_way);
            $("#tongdao").val(wechat_way);
            if (wechat_way == 2) {
                $("#xuan").html("官方无会员卡支付通道 ");
            } else if (wechat_way == 10) {
                $("#xuan").html("网商通道");

            } else {
                $("#xuan").html("微信官方通道");

            }
            $('input[name="wechat_way"]').prop("checked", false);
            $("#myModal1").modal('hide');
        } else if (wid == "tongdao2") {
            var ali_way = parseInt($('input[name="ali_way"]:checked').val());

            $("#tongdao2").val(ali_way);
            if (ali_way == 2) {
                $("#xuan2").html("官方无会员卡支付通道 ");
            } else if (ali_way == 10) {
                $("#xuan2").html("网商通道");

            } else {
                $("#xuan2").html("支付宝官方通道");

            }
            $('input[name="ali_way"]').prop("checked", false);
            $("#myModal1").modal('hide');
        }

    }
</script>
<script>
    function second_lb(obj){
        var seval=  $(obj).find("option:selected").attr("data-id");
        console.log(seval);
        $.ajax({
            url: "{:url('mach/getsubcate')}",
            type: "post",
            data: {
                id: seval
            },
            success: function (data) {
                console.log(11,data);
                if (data.code == 0) {
                    var data=data.data;
                    var list="";
                    for(var i=0;i<data.length;i++){

                        list+="<option value='" +data[i].name+"'>" +data[i].name+"</option>";
                    }
                    $("#secondary").append(list);
                }
            }
        })
    }
</script>
<script>
    $(function(){

        _init_area();
    })
</script>
<script type="text/javascript">
    // 地区
    var Gid  = document.getElementById ;

    var showArea = function(){

        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +

            Gid('s_city').value + " - 县/区" +

            Gid('s_county').value + "</h3>"

    }

    Gid('s_county').setAttribute('onchange','showArea()');

</script>
<script type="text/javascript">
    function ajaxtj(mid) {
        $.ajax({
            type: "POST",
            url: "{:url('Mach/getmomerchs')}",

            cache: false,
            dataType: "json",
            async: false,
            data: {
                id: mid,
            },

            success: function (data) {
                if (data.code == 1) {
                    alert('未获取到授权信息');
                } else {
                    $('#ali_merid').val(data.ali_merid);
                    $("#myModal").modal('hide');
                }
            }
        })


    }
    function publicUpload(file) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other',file);
        $.ajax({
            url: "{:url('uploads/machuploads')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            $(".exampleInputFile-src").attr("src",res.pic).removeClass("hide");
            $(".exampleInputFile-ipt").val(res.pic);
        }).fail(function (res) {
            alert("上传失败")
        });
    }

</script>

</body>

</html>
